<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><title>零成本搭建网页代理 | 云玩家</title><meta name="keywords" content="教程,白嫖"><meta name="author" content="云玩家"><meta name="copyright" content="云玩家"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta name="description" content="网页代理是非常简单的一种代理方式, 我们借助 CloudFlare 与 jsproxy 项目可以免费搭建自己的网页代理. 准备首先, 你需要有 Github 和 CloudFlare 账号 (怎么注册就不用我教了吧…) 并登陆. Githubfork jsproxy 项目,  然后进入到自己 fork 的 jsproxy 项目中, 进入 Settings 并下拉, 拉到 Github Pages">
<meta property="og:type" content="article">
<meta property="og:title" content="零成本搭建网页代理">
<meta property="og:url" content="http://yunist.cn/scribble/proxy_web/index.html">
<meta property="og:site_name" content="云玩家">
<meta property="og:description" content="网页代理是非常简单的一种代理方式, 我们借助 CloudFlare 与 jsproxy 项目可以免费搭建自己的网页代理. 准备首先, 你需要有 Github 和 CloudFlare 账号 (怎么注册就不用我教了吧…) 并登陆. Githubfork jsproxy 项目,  然后进入到自己 fork 的 jsproxy 项目中, 进入 Settings 并下拉, 拉到 Github Pages">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="http://yunist.cn/scribble/proxy_web/proxy_web.png">
<meta property="article:published_time" content="2020-08-01T13:11:08.000Z">
<meta property="article:modified_time" content="2021-08-14T04:39:34.449Z">
<meta property="article:author" content="云玩家">
<meta property="article:tag" content="教程">
<meta property="article:tag" content="白嫖">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="http://yunist.cn/scribble/proxy_web/proxy_web.png"><link rel="shortcut icon" href="/img/favicon.ico"><link rel="canonical" href="http://yunist.cn/scribble/proxy_web/"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//s4.cnzz.com"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css" media="print" onload="this.media='all'"><script async="async" data-pjax="data-pjax" src="https://s4.cnzz.com/z_stat.php?id=1278869595&amp;web_id=1278869595"></script><script>const GLOBAL_CONFIG = { 
  root: '/',
  algolia: undefined,
  localSearch: {"path":"search.xml","languages":{"hits_empty":"找不到您查询的内容：${query}"}},
  translate: undefined,
  noticeOutdate: undefined,
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true},
  copy: {
    success: '复制成功',
    error: '复制错误',
    noSupport: '浏览器不支持'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: '',
  date_suffix: {
    just: '刚刚',
    min: '分钟前',
    hour: '小时前',
    day: '天前',
    month: '个月前'
  },
  copyright: undefined,
  lightbox: 'fancybox',
  Snackbar: undefined,
  source: {
    jQuery: 'https://cdn.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js',
    justifiedGallery: {
      js: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/js/jquery.justifiedGallery.min.js',
      css: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/css/justifiedGallery.min.css'
    },
    fancybox: {
      js: 'https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.js',
      css: 'https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.css'
    }
  },
  isPhotoFigcaption: false,
  islazyload: false,
  isanchor: false
}</script><script src="/js/yuntools.js"></script><script id="config-diff">var GLOBAL_CONFIG_SITE = { 
  isPost: true,
  isHome: false,
  isHighlightShrink: false,
  isToc: true,
  postUpdate: '2021-08-14 12:39:34'
}</script><noscript><style type="text/css">
  #nav {
    opacity: 1
  }
  .justified-gallery img {
    opacity: 1
  }

  #recent-posts time,
  #post-meta time {
    display: inline !important
  }
</style></noscript><script>(win=>{
    win.saveToLocal = {
      set: function setWithExpiry(key, value, ttl) {
        if (ttl === 0) return
        const now = new Date()
        const expiryDay = ttl * 86400000
        const item = {
          value: value,
          expiry: now.getTime() + expiryDay,
        }
        localStorage.setItem(key, JSON.stringify(item))
      },

      get: function getWithExpiry(key) {
        const itemStr = localStorage.getItem(key)

        if (!itemStr) {
          return undefined
        }
        const item = JSON.parse(itemStr)
        const now = new Date()

        if (now.getTime() > item.expiry) {
          localStorage.removeItem(key)
          return undefined
        }
        return item.value
      }
    }
  
    win.getScript = url => new Promise((resolve, reject) => {
      const script = document.createElement('script')
      script.src = url
      script.async = true
      script.onerror = reject
      script.onload = script.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        script.onload = script.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(script)
    })
  
      win.activateDarkMode = function () {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      win.activateLightMode = function () {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
        }
      }
      const t = saveToLocal.get('theme')
    
          if (t === 'dark') activateDarkMode()
          else if (t === 'light') activateLightMode()
        
      const asideStatus = saveToLocal.get('aside-status')
      if (asideStatus !== undefined) {
        if (asideStatus === 'hide') {
          document.documentElement.classList.add('hide-aside')
        } else {
          document.documentElement.classList.remove('hide-aside')
        }
      }
    })(window)</script><link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/cnyist/blog/css/font.css"><meta name="generator" content="Hexo 5.4.0"></head><body><div id="web_bg"></div><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="author-avatar"><img class="avatar-img" src="https://cdn.jsdelivr.net/gh/cnyist/blog/img/avatar.svg" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="site-data"><div class="data-item is-center"><div class="data-item-link"><a href="/archives/"><div class="headline">文章</div><div class="length-num">97</div></a></div></div><div class="data-item is-center"><div class="data-item-link"><a href="/tags/"><div class="headline">标签</div><div class="length-num">40</div></a></div></div><div class="data-item is-center"><div class="data-item-link"><a href="/categories/"><div class="headline">分类</div><div class="length-num">27</div></a></div></div></div><hr/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 主页</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 时间轴</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fas fa-link"></i><span> 友链</span></a></div><div class="menus_item"><a class="site-page" href="/chat/"><i class="fa-fw fas fa-comments"></i><span> 闲聊室</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-user"></i><span> about</span></a></div><div class="menus_item"><a class="site-page" href="javascript:void(0);"><i class="fa-fw iconfont icon-Web"></i><span> 镜像站点</span><i class="fas fa-chevron-down expand"></i></a><ul class="menus_item_child"><li><a class="site-page" target="_blank" rel="noopener" href="https://yunist.gitee.io"><i class="fa-fw iconfont icon-gitee-fill-round"></i><span> Gitee Pages</span></a></li></ul></div></div></div></div><div class="post" id="body-wrap"><header class="post-bg" id="page-header" style="background-image: url('/scribble/proxy_web/proxy_web.png')"><nav id="nav"><span id="blog_name"><a id="site-name" href="/">云玩家</a></span><div id="menus"><div id="search-button"><a class="site-page social-icon search"><i class="fas fa-search fa-fw"></i><span> 搜索</span></a></div><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 主页</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 时间轴</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fas fa-link"></i><span> 友链</span></a></div><div class="menus_item"><a class="site-page" href="/chat/"><i class="fa-fw fas fa-comments"></i><span> 闲聊室</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-user"></i><span> about</span></a></div><div class="menus_item"><a class="site-page" href="javascript:void(0);"><i class="fa-fw iconfont icon-Web"></i><span> 镜像站点</span><i class="fas fa-chevron-down expand"></i></a><ul class="menus_item_child"><li><a class="site-page" target="_blank" rel="noopener" href="https://yunist.gitee.io"><i class="fa-fw iconfont icon-gitee-fill-round"></i><span> Gitee Pages</span></a></li></ul></div></div><div id="toggle-menu"><a class="site-page"><i class="fas fa-bars fa-fw"></i></a></div></div></nav><div id="post-info"><h1 class="post-title">零成本搭建网页代理</h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><i class="far fa-calendar-alt fa-fw post-meta-icon"></i><span class="post-meta-label">发表于</span><time class="post-meta-date-created" datetime="2020-08-01T13:11:08.000Z" title="发表于 2020-08-01 21:11:08">2020-08-01</time><span class="post-meta-separator">|</span><i class="fas fa-history fa-fw post-meta-icon"></i><span class="post-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2021-08-14T04:39:34.449Z" title="更新于 2021-08-14 12:39:34">2021-08-14</time></span><span class="post-meta-categories"><span class="post-meta-separator">|</span><i class="fas fa-inbox fa-fw post-meta-icon"></i><a class="post-meta-categories" href="/categories/%E6%9D%82%E6%96%87/">杂文</a></span></div><div class="meta-secondline"><span class="post-meta-separator">|</span><span class="post-meta-pv-cv"><i class="far fa-eye fa-fw post-meta-icon"></i><span class="post-meta-label">阅读量:</span><span id="busuanzi_value_page_pv"></span></span><span class="post-meta-separator">|</span><span class="post-meta-commentcount"><i class="far fa-comments fa-fw post-meta-icon"></i><span class="post-meta-label">评论数:</span><a href="/scribble/proxy_web/#post-comment"><span id="twikoo-count"></span></a></span></div></div></div></header><main class="layout" id="content-inner"><div id="post"><article class="post-content" id="article-container"><p>网页代理是非常简单的一种代理方式, 我们借助 <a target="_blank" rel="noopener" href="https://cloudflare.com/">CloudFlare</a> 与 <a target="_blank" rel="noopener" href="https://github.com/EtherDream/jsproxy">jsproxy</a> 项目可以免费搭建自己的网页代理.</p>
<h1 id="准备"><a href="#准备" class="headerlink" title="准备"></a>准备</h1><p>首先, 你需要有 <a target="_blank" rel="noopener" href="https://github.com/">Github</a> 和 <a target="_blank" rel="noopener" href="https://cloudflare.com/">CloudFlare</a> 账号 (怎么注册就不用我教了吧…) 并登陆.</p>
<h1 id="Github"><a href="#Github" class="headerlink" title="Github"></a>Github</h1><p>fork <a target="_blank" rel="noopener" href="https://github.com/EtherDream/jsproxy">jsproxy</a> 项目,</p>
<p><img src="1.png"></p>
<p>然后进入到自己 fork 的 jsproxy 项目中, 进入 Settings 并下拉, 拉到 Github Pages 这一项</p>
<p><img src="2.png"></p>
<p>将 Select branch 设置成 gh-pages , 并 Save (这里我已经设置过了所以无法点击), 重新刷新并来到同样的位置, 它会显示大概如下内容</p>
<blockquote>
<p>Your site is published at <a target="_blank" rel="noopener" href="https://xxxx.github.io/jsproxy/">https://xxxx.github.io/jsproxy/</a></p>
</blockquote>
<p>后面那串网址就是你的 Pages 地址, 记住它.</p>
<h1 id="CloudFlare"><a href="#CloudFlare" class="headerlink" title="CloudFlare"></a>CloudFlare</h1><p>进入<a target="_blank" rel="noopener" href="https://dash.cloudflare.com/">主页</a>, 然后进入 Workers ,</p>
<p><img src="3.png"></p>
<p>并创建 Worker,</p>
<p><img src="4.png"></p>
<p>然后在左侧的 “脚本” 区写下如下代码, 其中第 6 行中 <code>https://xxxx.github.io/jsproxy</code> 需要替换成你的 Pages 地址 (就是我前面叫你记住的那个) ,</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br><span class="line">128</span><br><span class="line">129</span><br><span class="line">130</span><br><span class="line">131</span><br><span class="line">132</span><br><span class="line">133</span><br><span class="line">134</span><br><span class="line">135</span><br><span class="line">136</span><br><span class="line">137</span><br><span class="line">138</span><br><span class="line">139</span><br><span class="line">140</span><br><span class="line">141</span><br><span class="line">142</span><br><span class="line">143</span><br><span class="line">144</span><br><span class="line">145</span><br><span class="line">146</span><br><span class="line">147</span><br><span class="line">148</span><br><span class="line">149</span><br><span class="line">150</span><br><span class="line">151</span><br><span class="line">152</span><br><span class="line">153</span><br><span class="line">154</span><br><span class="line">155</span><br><span class="line">156</span><br><span class="line">157</span><br><span class="line">158</span><br><span class="line">159</span><br><span class="line">160</span><br><span class="line">161</span><br><span class="line">162</span><br><span class="line">163</span><br><span class="line">164</span><br><span class="line">165</span><br><span class="line">166</span><br><span class="line">167</span><br><span class="line">168</span><br><span class="line">169</span><br><span class="line">170</span><br><span class="line">171</span><br><span class="line">172</span><br><span class="line">173</span><br><span class="line">174</span><br><span class="line">175</span><br><span class="line">176</span><br><span class="line">177</span><br><span class="line">178</span><br><span class="line">179</span><br><span class="line">180</span><br><span class="line">181</span><br><span class="line">182</span><br><span class="line">183</span><br><span class="line">184</span><br><span class="line">185</span><br><span class="line">186</span><br><span class="line">187</span><br><span class="line">188</span><br><span class="line">189</span><br><span class="line">190</span><br><span class="line">191</span><br><span class="line">192</span><br><span class="line">193</span><br><span class="line">194</span><br><span class="line">195</span><br><span class="line">196</span><br><span class="line">197</span><br><span class="line">198</span><br><span class="line">199</span><br><span class="line">200</span><br><span class="line">201</span><br><span class="line">202</span><br><span class="line">203</span><br><span class="line">204</span><br><span class="line">205</span><br><span class="line">206</span><br><span class="line">207</span><br><span class="line">208</span><br><span class="line">209</span><br><span class="line">210</span><br><span class="line">211</span><br><span class="line">212</span><br><span class="line">213</span><br><span class="line">214</span><br><span class="line">215</span><br><span class="line">216</span><br><span class="line">217</span><br><span class="line">218</span><br><span class="line">219</span><br><span class="line">220</span><br><span class="line">221</span><br><span class="line">222</span><br><span class="line">223</span><br><span class="line">224</span><br><span class="line">225</span><br><span class="line">226</span><br><span class="line">227</span><br><span class="line">228</span><br><span class="line">229</span><br><span class="line">230</span><br><span class="line">231</span><br><span class="line">232</span><br><span class="line">233</span><br><span class="line">234</span><br><span class="line">235</span><br><span class="line">236</span><br><span class="line">237</span><br><span class="line">238</span><br><span class="line">239</span><br><span class="line">240</span><br><span class="line">241</span><br><span class="line">242</span><br><span class="line">243</span><br><span class="line">244</span><br><span class="line">245</span><br><span class="line">246</span><br><span class="line">247</span><br><span class="line">248</span><br><span class="line">249</span><br><span class="line">250</span><br><span class="line">251</span><br><span class="line">252</span><br><span class="line">253</span><br><span class="line">254</span><br><span class="line">255</span><br><span class="line">256</span><br><span class="line">257</span><br><span class="line">258</span><br><span class="line">259</span><br><span class="line">260</span><br><span class="line">261</span><br><span class="line">262</span><br><span class="line">263</span><br><span class="line">264</span><br><span class="line">265</span><br><span class="line">266</span><br><span class="line">267</span><br><span class="line">268</span><br><span class="line">269</span><br><span class="line">270</span><br><span class="line">271</span><br><span class="line">272</span><br><span class="line">273</span><br><span class="line">274</span><br><span class="line">275</span><br><span class="line">276</span><br><span class="line">277</span><br><span class="line">278</span><br><span class="line">279</span><br><span class="line">280</span><br><span class="line">281</span><br><span class="line">282</span><br><span class="line">283</span><br><span class="line">284</span><br><span class="line">285</span><br><span class="line">286</span><br><span class="line">287</span><br><span class="line">288</span><br><span class="line">289</span><br><span class="line">290</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&#x27;use strict&#x27;</span></span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * static files (404.html, sw.js, conf.js)</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">const</span> ASSET_URL = <span class="string">&#x27;https://xxxx.github.io/jsproxy&#x27;</span><span class="comment">//这里填写你Github pages的网址！</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">const</span> JS_VER = <span class="number">10</span></span><br><span class="line"><span class="keyword">const</span> MAX_RETRY = <span class="number">1</span></span><br><span class="line"></span><br><span class="line"><span class="comment">/** <span class="doctag">@type <span class="type">&#123;RequestInit&#125;</span> </span>*/</span></span><br><span class="line"><span class="keyword">const</span> PREFLIGHT_INIT = &#123;</span><br><span class="line">  status: <span class="number">204</span>,</span><br><span class="line">  headers: <span class="keyword">new</span> Headers(&#123;</span><br><span class="line">    <span class="string">&#x27;access-control-allow-origin&#x27;</span>: <span class="string">&#x27;*&#x27;</span>,</span><br><span class="line">    <span class="string">&#x27;access-control-allow-methods&#x27;</span>: <span class="string">&#x27;GET,POST,PUT,PATCH,TRACE,DELETE,HEAD,OPTIONS&#x27;</span>,</span><br><span class="line">    <span class="string">&#x27;access-control-max-age&#x27;</span>: <span class="string">&#x27;1728000&#x27;</span>,</span><br><span class="line">  &#125;),</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param <span class="type">&#123;any&#125;</span> <span class="variable">body</span></span></span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param <span class="type">&#123;number&#125;</span> <span class="variable">status</span></span></span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param <span class="type">&#123;Object&lt;string, string&gt;&#125;</span> <span class="variable">headers</span></span></span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="function"><span class="keyword">function</span> <span class="title">makeRes</span>(<span class="params">body, status = <span class="number">200</span>, headers = &#123;&#125;</span>) </span>&#123;</span><br><span class="line">  headers[<span class="string">&#x27;--ver&#x27;</span>] = JS_VER</span><br><span class="line">  headers[<span class="string">&#x27;access-control-allow-origin&#x27;</span>] = <span class="string">&#x27;*&#x27;</span></span><br><span class="line">  <span class="keyword">return</span> <span class="keyword">new</span> Response(body, &#123;status, headers&#125;)</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param <span class="type">&#123;string&#125;</span> </span>urlStr </span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="function"><span class="keyword">function</span> <span class="title">newUrl</span>(<span class="params">urlStr</span>) </span>&#123;</span><br><span class="line">  <span class="keyword">try</span> &#123;</span><br><span class="line">    <span class="keyword">return</span> <span class="keyword">new</span> URL(urlStr)</span><br><span class="line">  &#125; <span class="keyword">catch</span> (err) &#123;</span><br><span class="line">    <span class="keyword">return</span> <span class="literal">null</span></span><br><span class="line">  &#125;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">addEventListener(<span class="string">&#x27;fetch&#x27;</span>, <span class="function"><span class="params">e</span> =&gt;</span> &#123;</span><br><span class="line">  <span class="keyword">const</span> ret = fetchHandler(e)</span><br><span class="line">    .catch(<span class="function"><span class="params">err</span> =&gt;</span> makeRes(<span class="string">&#x27;cfworker error:\n&#x27;</span> + err.stack, <span class="number">502</span>))</span><br><span class="line">  e.respondWith(ret)</span><br><span class="line">&#125;)</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param <span class="type">&#123;FetchEvent&#125;</span> </span>e </span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">async</span> <span class="function"><span class="keyword">function</span> <span class="title">fetchHandler</span>(<span class="params">e</span>) </span>&#123;</span><br><span class="line">  <span class="keyword">const</span> req = e.request</span><br><span class="line">  <span class="keyword">const</span> urlStr = req.url</span><br><span class="line">  <span class="keyword">const</span> urlObj = <span class="keyword">new</span> URL(urlStr)</span><br><span class="line">  <span class="keyword">const</span> path = urlObj.href.substr(urlObj.origin.length)</span><br><span class="line"></span><br><span class="line">  <span class="keyword">if</span> (urlObj.protocol === <span class="string">&#x27;http:&#x27;</span>) &#123;</span><br><span class="line">    urlObj.protocol = <span class="string">&#x27;https:&#x27;</span></span><br><span class="line">    <span class="keyword">return</span> makeRes(<span class="string">&#x27;&#x27;</span>, <span class="number">301</span>, &#123;</span><br><span class="line">      <span class="string">&#x27;strict-transport-security&#x27;</span>: <span class="string">&#x27;max-age=99999999; includeSubDomains; preload&#x27;</span>,</span><br><span class="line">      <span class="string">&#x27;location&#x27;</span>: urlObj.href,</span><br><span class="line">    &#125;)</span><br><span class="line">  &#125;</span><br><span class="line"></span><br><span class="line">  <span class="keyword">if</span> (path.startsWith(<span class="string">&#x27;/http/&#x27;</span>)) &#123;</span><br><span class="line">    <span class="keyword">return</span> httpHandler(req, path.substr(<span class="number">6</span>))</span><br><span class="line">  &#125;</span><br><span class="line"></span><br><span class="line">  <span class="keyword">switch</span> (path) &#123;</span><br><span class="line">  <span class="keyword">case</span> <span class="string">&#x27;/http&#x27;</span>:</span><br><span class="line">    <span class="keyword">return</span> makeRes(<span class="string">&#x27;请更新 cfworker 到最新版本!&#x27;</span>)</span><br><span class="line">  <span class="keyword">case</span> <span class="string">&#x27;/ws&#x27;</span>:</span><br><span class="line">    <span class="keyword">return</span> makeRes(<span class="string">&#x27;not support&#x27;</span>, <span class="number">400</span>)</span><br><span class="line">  <span class="keyword">case</span> <span class="string">&#x27;/works&#x27;</span>:</span><br><span class="line">    <span class="keyword">return</span> makeRes(<span class="string">&#x27;it works&#x27;</span>)</span><br><span class="line">  <span class="keyword">default</span>:</span><br><span class="line">    <span class="comment">// static files</span></span><br><span class="line">    <span class="keyword">return</span> fetch(ASSET_URL + path)</span><br><span class="line">  &#125;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param <span class="type">&#123;Request&#125;</span> <span class="variable">req</span></span></span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param <span class="type">&#123;string&#125;</span> <span class="variable">pathname</span></span></span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="function"><span class="keyword">function</span> <span class="title">httpHandler</span>(<span class="params">req, pathname</span>) </span>&#123;</span><br><span class="line">  <span class="keyword">const</span> reqHdrRaw = req.headers</span><br><span class="line">  <span class="keyword">if</span> (reqHdrRaw.has(<span class="string">&#x27;x-jsproxy&#x27;</span>)) &#123;</span><br><span class="line">    <span class="keyword">return</span> Response.error()</span><br><span class="line">  &#125;</span><br><span class="line"></span><br><span class="line">  <span class="comment">// preflight</span></span><br><span class="line">  <span class="keyword">if</span> (req.method === <span class="string">&#x27;OPTIONS&#x27;</span> &amp;&amp;</span><br><span class="line">      reqHdrRaw.has(<span class="string">&#x27;access-control-request-headers&#x27;</span>)</span><br><span class="line">  ) &#123;</span><br><span class="line">    <span class="keyword">return</span> <span class="keyword">new</span> Response(<span class="literal">null</span>, PREFLIGHT_INIT)</span><br><span class="line">  &#125;</span><br><span class="line"></span><br><span class="line">  <span class="keyword">let</span> acehOld = <span class="literal">false</span></span><br><span class="line">  <span class="keyword">let</span> rawSvr = <span class="string">&#x27;&#x27;</span></span><br><span class="line">  <span class="keyword">let</span> rawLen = <span class="string">&#x27;&#x27;</span></span><br><span class="line">  <span class="keyword">let</span> rawEtag = <span class="string">&#x27;&#x27;</span></span><br><span class="line"></span><br><span class="line">  <span class="keyword">const</span> reqHdrNew = <span class="keyword">new</span> Headers(reqHdrRaw)</span><br><span class="line">  reqHdrNew.set(<span class="string">&#x27;x-jsproxy&#x27;</span>, <span class="string">&#x27;1&#x27;</span>)</span><br><span class="line"></span><br><span class="line">  <span class="comment">// 此处逻辑和 http-dec-req-hdr.lua 大致相同</span></span><br><span class="line">  <span class="comment">// https://github.com/EtherDream/jsproxy/blob/master/lua/http-dec-req-hdr.lua</span></span><br><span class="line">  <span class="keyword">const</span> refer = reqHdrNew.get(<span class="string">&#x27;referer&#x27;</span>)</span><br><span class="line">  <span class="keyword">const</span> query = refer.substr(refer.indexOf(<span class="string">&#x27;?&#x27;</span>) + <span class="number">1</span>)</span><br><span class="line">  <span class="keyword">if</span> (!query) &#123;</span><br><span class="line">    <span class="keyword">return</span> makeRes(<span class="string">&#x27;missing params&#x27;</span>, <span class="number">403</span>)</span><br><span class="line">  &#125;</span><br><span class="line">  <span class="keyword">const</span> param = <span class="keyword">new</span> URLSearchParams(query)</span><br><span class="line"></span><br><span class="line">  <span class="keyword">for</span> (<span class="keyword">const</span> [k, v] <span class="keyword">of</span> <span class="built_in">Object</span>.entries(param)) &#123;</span><br><span class="line">    <span class="keyword">if</span> (k.substr(<span class="number">0</span>, <span class="number">2</span>) === <span class="string">&#x27;--&#x27;</span>) &#123;</span><br><span class="line">      <span class="comment">// 系统信息</span></span><br><span class="line">      <span class="keyword">switch</span> (k.substr(<span class="number">2</span>)) &#123;</span><br><span class="line">      <span class="keyword">case</span> <span class="string">&#x27;aceh&#x27;</span>:</span><br><span class="line">        acehOld = <span class="literal">true</span></span><br><span class="line">        <span class="keyword">break</span></span><br><span class="line">      <span class="keyword">case</span> <span class="string">&#x27;raw-info&#x27;</span>:</span><br><span class="line">        [rawSvr, rawLen, rawEtag] = v.split(<span class="string">&#x27;|&#x27;</span>)</span><br><span class="line">        <span class="keyword">break</span></span><br><span class="line">      &#125;</span><br><span class="line">    &#125; <span class="keyword">else</span> &#123;</span><br><span class="line">      <span class="comment">// 还原 HTTP 请求头</span></span><br><span class="line">      <span class="keyword">if</span> (v) &#123;</span><br><span class="line">        reqHdrNew.set(k, v)</span><br><span class="line">      &#125; <span class="keyword">else</span> &#123;</span><br><span class="line">        reqHdrNew.delete(k)</span><br><span class="line">      &#125;</span><br><span class="line">    &#125;</span><br><span class="line">  &#125;</span><br><span class="line">  <span class="keyword">if</span> (!param.has(<span class="string">&#x27;referer&#x27;</span>)) &#123;</span><br><span class="line">    reqHdrNew.delete(<span class="string">&#x27;referer&#x27;</span>)</span><br><span class="line">  &#125;</span><br><span class="line"></span><br><span class="line">  <span class="comment">// cfworker 会把路径中的 `//` 合并成 `/`</span></span><br><span class="line">  <span class="keyword">const</span> urlStr = pathname.replace(<span class="regexp">/^(https?):\/+/</span>, <span class="string">&#x27;$1://&#x27;</span>)</span><br><span class="line">  <span class="keyword">const</span> urlObj = newUrl(urlStr)</span><br><span class="line">  <span class="keyword">if</span> (!urlObj) &#123;</span><br><span class="line">    <span class="keyword">return</span> makeRes(<span class="string">&#x27;invalid proxy url: &#x27;</span> + urlStr, <span class="number">403</span>)</span><br><span class="line">  &#125;</span><br><span class="line"></span><br><span class="line">  <span class="comment">/** <span class="doctag">@type <span class="type">&#123;RequestInit&#125;</span> </span>*/</span></span><br><span class="line">  <span class="keyword">const</span> reqInit = &#123;</span><br><span class="line">    method: req.method,</span><br><span class="line">    headers: reqHdrNew,</span><br><span class="line">    redirect: <span class="string">&#x27;manual&#x27;</span>,</span><br><span class="line">  &#125;</span><br><span class="line">  <span class="keyword">if</span> (req.method === <span class="string">&#x27;POST&#x27;</span>) &#123;</span><br><span class="line">    reqInit.body = req.body</span><br><span class="line">  &#125;</span><br><span class="line">  <span class="keyword">return</span> proxy(urlObj, reqInit, acehOld, rawLen, <span class="number">0</span>)</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * </span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param <span class="type">&#123;URL&#125;</span> </span>urlObj </span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param <span class="type">&#123;RequestInit&#125;</span> </span>reqInit </span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param <span class="type">&#123;number&#125;</span> </span>retryTimes </span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">async</span> <span class="function"><span class="keyword">function</span> <span class="title">proxy</span>(<span class="params">urlObj, reqInit, acehOld, rawLen, retryTimes</span>) </span>&#123;</span><br><span class="line">  <span class="keyword">const</span> res = <span class="keyword">await</span> fetch(urlObj.href, reqInit)</span><br><span class="line">  <span class="keyword">const</span> resHdrOld = res.headers</span><br><span class="line">  <span class="keyword">const</span> resHdrNew = <span class="keyword">new</span> Headers(resHdrOld)</span><br><span class="line"></span><br><span class="line">  <span class="keyword">let</span> expose = <span class="string">&#x27;*&#x27;</span></span><br><span class="line">  </span><br><span class="line">  <span class="keyword">for</span> (<span class="keyword">const</span> [k, v] <span class="keyword">of</span> resHdrOld.entries()) &#123;</span><br><span class="line">    <span class="keyword">if</span> (k === <span class="string">&#x27;access-control-allow-origin&#x27;</span> ||</span><br><span class="line">        k === <span class="string">&#x27;access-control-expose-headers&#x27;</span> ||</span><br><span class="line">        k === <span class="string">&#x27;location&#x27;</span> ||</span><br><span class="line">        k === <span class="string">&#x27;set-cookie&#x27;</span></span><br><span class="line">    ) &#123;</span><br><span class="line">      <span class="keyword">const</span> x = <span class="string">&#x27;--&#x27;</span> + k</span><br><span class="line">      resHdrNew.set(x, v)</span><br><span class="line">      <span class="keyword">if</span> (acehOld) &#123;</span><br><span class="line">        expose = expose + <span class="string">&#x27;,&#x27;</span> + x</span><br><span class="line">      &#125;</span><br><span class="line">      resHdrNew.delete(k)</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="keyword">else</span> <span class="keyword">if</span> (acehOld &amp;&amp;</span><br><span class="line">      k !== <span class="string">&#x27;cache-control&#x27;</span> &amp;&amp;</span><br><span class="line">      k !== <span class="string">&#x27;content-language&#x27;</span> &amp;&amp;</span><br><span class="line">      k !== <span class="string">&#x27;content-type&#x27;</span> &amp;&amp;</span><br><span class="line">      k !== <span class="string">&#x27;expires&#x27;</span> &amp;&amp;</span><br><span class="line">      k !== <span class="string">&#x27;last-modified&#x27;</span> &amp;&amp;</span><br><span class="line">      k !== <span class="string">&#x27;pragma&#x27;</span></span><br><span class="line">    ) &#123;</span><br><span class="line">      expose = expose + <span class="string">&#x27;,&#x27;</span> + k</span><br><span class="line">    &#125;</span><br><span class="line">  &#125;</span><br><span class="line"></span><br><span class="line">  <span class="keyword">if</span> (acehOld) &#123;</span><br><span class="line">    expose = expose + <span class="string">&#x27;,--s&#x27;</span></span><br><span class="line">    resHdrNew.set(<span class="string">&#x27;--t&#x27;</span>, <span class="string">&#x27;1&#x27;</span>)</span><br><span class="line">  &#125;</span><br><span class="line"></span><br><span class="line">  <span class="comment">// verify</span></span><br><span class="line">  <span class="keyword">if</span> (rawLen) &#123;</span><br><span class="line">    <span class="keyword">const</span> newLen = resHdrOld.get(<span class="string">&#x27;content-length&#x27;</span>) || <span class="string">&#x27;&#x27;</span></span><br><span class="line">    <span class="keyword">const</span> badLen = (rawLen !== newLen)</span><br><span class="line"></span><br><span class="line">    <span class="keyword">if</span> (badLen) &#123;</span><br><span class="line">      <span class="keyword">if</span> (retryTimes &lt; MAX_RETRY) &#123;</span><br><span class="line">        urlObj = <span class="keyword">await</span> parseYtVideoRedir(urlObj, newLen, res)</span><br><span class="line">        <span class="keyword">if</span> (urlObj) &#123;</span><br><span class="line">          <span class="keyword">return</span> proxy(urlObj, reqInit, acehOld, rawLen, retryTimes + <span class="number">1</span>)</span><br><span class="line">        &#125;</span><br><span class="line">      &#125;</span><br><span class="line">      <span class="keyword">return</span> makeRes(res.body, <span class="number">400</span>, &#123;</span><br><span class="line">        <span class="string">&#x27;--error&#x27;</span>: <span class="string">`bad len: <span class="subst">$&#123;newLen&#125;</span>, except: <span class="subst">$&#123;rawLen&#125;</span>`</span>,</span><br><span class="line">        <span class="string">&#x27;access-control-expose-headers&#x27;</span>: <span class="string">&#x27;--error&#x27;</span>,</span><br><span class="line">      &#125;)</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="keyword">if</span> (retryTimes &gt; <span class="number">1</span>) &#123;</span><br><span class="line">      resHdrNew.set(<span class="string">&#x27;--retry&#x27;</span>, retryTimes)</span><br><span class="line">    &#125;</span><br><span class="line">  &#125;</span><br><span class="line"></span><br><span class="line">  <span class="keyword">let</span> status = res.status</span><br><span class="line"></span><br><span class="line">  resHdrNew.set(<span class="string">&#x27;access-control-expose-headers&#x27;</span>, expose)</span><br><span class="line">  resHdrNew.set(<span class="string">&#x27;access-control-allow-origin&#x27;</span>, <span class="string">&#x27;*&#x27;</span>)</span><br><span class="line">  resHdrNew.set(<span class="string">&#x27;--s&#x27;</span>, status)</span><br><span class="line">  resHdrNew.set(<span class="string">&#x27;--ver&#x27;</span>, JS_VER)</span><br><span class="line"></span><br><span class="line">  resHdrNew.delete(<span class="string">&#x27;content-security-policy&#x27;</span>)</span><br><span class="line">  resHdrNew.delete(<span class="string">&#x27;content-security-policy-report-only&#x27;</span>)</span><br><span class="line">  resHdrNew.delete(<span class="string">&#x27;clear-site-data&#x27;</span>)</span><br><span class="line"></span><br><span class="line">  <span class="keyword">if</span> (status === <span class="number">301</span> ||</span><br><span class="line">      status === <span class="number">302</span> ||</span><br><span class="line">      status === <span class="number">303</span> ||</span><br><span class="line">      status === <span class="number">307</span> ||</span><br><span class="line">      status === <span class="number">308</span></span><br><span class="line">  ) &#123;</span><br><span class="line">    status = status + <span class="number">10</span></span><br><span class="line">  &#125;</span><br><span class="line"></span><br><span class="line">  <span class="keyword">return</span> <span class="keyword">new</span> Response(res.body, &#123;</span><br><span class="line">    status,</span><br><span class="line">    headers: resHdrNew,</span><br><span class="line">  &#125;)</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param <span class="type">&#123;URL&#125;</span> </span>urlObj </span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="function"><span class="keyword">function</span> <span class="title">isYtUrl</span>(<span class="params">urlObj</span>) </span>&#123;</span><br><span class="line">  <span class="keyword">return</span> (</span><br><span class="line">    urlObj.host.endsWith(<span class="string">&#x27;.googlevideo.com&#x27;</span>) &amp;&amp;</span><br><span class="line">    urlObj.pathname.startsWith(<span class="string">&#x27;/videoplayback&#x27;</span>)</span><br><span class="line">  )</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param <span class="type">&#123;URL&#125;</span> </span>urlObj </span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param <span class="type">&#123;number&#125;</span> </span>newLen </span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param <span class="type">&#123;Response&#125;</span> </span>res </span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">async</span> <span class="function"><span class="keyword">function</span> <span class="title">parseYtVideoRedir</span>(<span class="params">urlObj, newLen, res</span>) </span>&#123;</span><br><span class="line">  <span class="keyword">if</span> (newLen &gt; <span class="number">2000</span>) &#123;</span><br><span class="line">    <span class="keyword">return</span> <span class="literal">null</span></span><br><span class="line">  &#125;</span><br><span class="line">  <span class="keyword">if</span> (!isYtUrl(urlObj)) &#123;</span><br><span class="line">    <span class="keyword">return</span> <span class="literal">null</span></span><br><span class="line">  &#125;</span><br><span class="line">  <span class="keyword">try</span> &#123;</span><br><span class="line">    <span class="keyword">const</span> data = <span class="keyword">await</span> res.text()</span><br><span class="line">    urlObj = <span class="keyword">new</span> URL(data)</span><br><span class="line">  &#125; <span class="keyword">catch</span> (err) &#123;</span><br><span class="line">    <span class="keyword">return</span> <span class="literal">null</span></span><br><span class="line">  &#125;</span><br><span class="line">  <span class="keyword">if</span> (!isYtUrl(urlObj)) &#123;</span><br><span class="line">    <span class="keyword">return</span> <span class="literal">null</span></span><br><span class="line">  &#125;</span><br><span class="line">  <span class="keyword">return</span> urlObj</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<p>然后点击 “保存并部署”, </p>
<p><img src="5.png"></p>
<p>然后在右侧的红框框内, 就可以看到你的网页代理的网址, 类似 <a target="_blank" rel="noopener" href="https://xxxx.xxxx.workers.dev/">https://xxxx.xxxx.workers.dev</a> 这样的.</p>
<p>这样, 你的网页代理就搭建好啦! 只要访问网页代理的网址, 就可以突破 GFW 轻松浏览被墙的网站了.</p>
<h1 id="绑定域名"><a href="#绑定域名" class="headerlink" title="绑定域名"></a>绑定域名</h1><p>首先需要拥有一个域名 (可以去 <a target="_blank" rel="noopener" href="https://www.freenom.com/">Freenom</a> 获取免费域名) 并且将域名托管到 CloudFlare (什么你问我怎么托管??? <del>有手就行</del>). 然后进入你的域名界面, 进入 Workers,</p>
<p><img src="6.png"></p>
<p>然后点击 “添加路由” , 在 “路由” 内填写你的域名以及二级前缀 (不知道什么是二级域名的自行百度…) 格式为 <code>二级前缀.你的域名/* </code> 并且在 “Worker” 中选你刚刚部署的 Worker,</p>
<p><img src="7.png"></p>
<p>当然这样还没完, 进入你域名的 DNS 解析到 CloudFlare 给你的 Worker 的域名</p>
<p><img src="8,png"></p>
<p>其中 “类型” 选择 “CNAME” , “名称” 填你的二级前缀, 内容填 CloudFlare 给你的 Worker 的域名 (类似 xxx.xxx.workers.dev) 然后保存.</p>
<p>这样域名就绑定成功, 可以访问你自己的域名愉快的 FQ 啦!</p>
</article><div class="post-copyright"><div class="post-copyright__author"><span class="post-copyright-meta">文章作者: </span><span class="post-copyright-info"><a href="mailto:undefined">云玩家</a></span></div><div class="post-copyright__type"><span class="post-copyright-meta">文章链接: </span><span class="post-copyright-info"><a href="http://yunist.cn/scribble/proxy_web/">http://yunist.cn/scribble/proxy_web/</a></span></div><div class="post-copyright__notice"><span class="post-copyright-meta">版权声明: </span><span class="post-copyright-info">本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank">CC BY-NC-SA 4.0</a> 许可协议。转载请注明来自 <a href="http://yunist.cn" target="_blank">云玩家</a>！</span></div></div><div class="tag_share"><div class="post-meta__tag-list"><a class="post-meta__tags" href="/tags/%E6%95%99%E7%A8%8B/">教程</a><a class="post-meta__tags" href="/tags/%E7%99%BD%E5%AB%96/">白嫖</a></div><div class="post_share"><div class="social-share" data-image="/scribble/proxy_web/proxy_web.png" data-sites="facebook,twitter,wechat,weibo,qq"></div><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/social-share.js/dist/css/share.min.css" media="print" onload="this.media='all'"><script src="https://cdn.jsdelivr.net/npm/social-share.js/dist/js/social-share.min.js" defer></script></div></div><nav class="pagination-post" id="pagination"><div class="prev-post pull-left"><!-- - var pagination_cover = prev.cover === false ? prev.randomcover : prev.cover--><a href="/ML/RL/primer/GAE/"><img class="prev-cover" src="https://cdn.jsdelivr.net/gh/cnyist/blog/ML/RL/primer/GAE/GAE.jpg" onerror="onerror=null;src='/img/404.jpg'" alt="cover of previous post"><div class="pagination-info"><div class="label">上一篇</div><div class="prev_info">GAE 算法</div></div></a></div><!-- - var pagination_cover = next.cover == false ? next.randomcover : next.cover--><div class="next-post pull-right"><a href="/scribble/make_api/"><img class="next-cover" src="https://cdn.jsdelivr.net/gh/cnyist/blog/scribble/make_api/make_api.png" onerror="onerror=null;src='/img/404.jpg'" alt="cover of next post"><div class="pagination-info"><div class="label">下一篇</div><div class="next_info">零成本制作随机图片 API</div></div></a></div></nav><div class="relatedPosts"><div class="headline"><i class="fas fa-thumbs-up fa-fw"></i><span> 相关推荐</span></div><div class="relatedPosts-list"><div><a href="/scribble/make_api/" title="零成本制作随机图片 API"><img class="cover" src="https://cdn.jsdelivr.net/gh/cnyist/blog/scribble/make_api/make_api.png" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2020-07-31</div><div class="title">零成本制作随机图片 API</div></div></a></div><div><a href="/hexo/back_blog_up/" title="手把手教你将博客备份到 Github"><img class="cover" src="https://cdn.jsdelivr.net/gh/cnyist/blog/hexo/back_blog_up/back_blog_up.png" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2020-04-10</div><div class="title">手把手教你将博客备份到 Github</div></div></a></div><div><a href="/hexo/valine_admin/" title="Valine 评论回复增强"><img class="cover" src="https://cdn.jsdelivr.net/gh/cnyist/blog/hexo/valine_admin/valine_admin.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2020-04-19</div><div class="title">Valine 评论回复增强</div></div></a></div><div><a href="/scribble/build_nav/" title="如何快速搭建一个属于自己的网址导航"><img class="cover" src="https://cdn.jsdelivr.net/gh/cnyist/blog/scribble/build_nav/build_nav.png" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2020-04-10</div><div class="title">如何快速搭建一个属于自己的网址导航</div></div></a></div><div><a href="/scribble/ggb_insert/" title="在网页中嵌入 GGB 最简单的方法"><img class="cover" src="https://cdn.jsdelivr.net/gh/cnyist/blog/scribble/ggb_insert/ggb_insert.png" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2021-04-04</div><div class="title">在网页中嵌入 GGB 最简单的方法</div></div></a></div><div><a href="/scribble/player_in_blog/" title="为你的博客添加一个播放器"><img class="cover" src="https://cdn.jsdelivr.net/gh/cnyist/blog/scribble/player_in_blog/player_in_blog.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2020-11-29</div><div class="title">为你的博客添加一个播放器</div></div></a></div></div></div><hr/><div id="post-comment"><div class="comment-head"><div class="comment-headline"><i class="fas fa-comments fa-fw"></i><span> 评论</span></div></div><div class="comment-wrap"><div><div id="twikoo-wrap"></div></div></div></div></div><div class="aside-content" id="aside-content"><div class="card-widget card-info"><div class="card-info-avatar is-center"><img class="avatar-img" src="https://cdn.jsdelivr.net/gh/cnyist/blog/img/avatar.svg" onerror="this.onerror=null;this.src='/img/friend_404.gif'" alt="avatar"/><div class="author-info__name">云玩家</div><div class="author-info__description">云玩家's blog</div></div><div class="card-info-data"><div class="card-info-data-item is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">97</div></a></div><div class="card-info-data-item is-center"><a href="/tags/"><div class="headline">标签</div><div class="length-num">40</div></a></div><div class="card-info-data-item is-center"><a href="/categories/"><div class="headline">分类</div><div class="length-num">27</div></a></div></div><a class="button--animated" id="card-info-btn" target="_blank" rel="noopener" href="https://github.com/xxxxxx"><i class="fab fa-github"></i><span>Follow Me</span></a><div class="card-info-social-icons is-center"><a class="social-icon" href="https://github.com/cnyist" target="_blank" title="Github"><i class="fab fa-github"></i></a><a class="social-icon" href="https://blog.csdn.net/chnyist" target="_blank" title="CSDN"><i class="fas iconfont icon-CN_csdnnet"></i></a><a class="social-icon" href="https://www.zhihu.com/people/cnyist" target="_blank" title="知乎"><i class="fas iconfont icon-zhihu"></i></a><a class="social-icon" href="mailto:yunist@qq.com" target="_blank" title="Email"><i class="fas fa-envelope"></i></a></div></div><div class="card-widget card-announcement"><div class="item-headline"><i class="fas fa-bullhorn card-announcement-animation"></i><span>公告</span></div><div class="announcement_content">This is my Blog</div></div><div class="sticky_layout"><div class="card-widget" id="card-toc"><div class="item-headline"><i class="fas fa-stream"></i><span>目录</span></div><div class="toc-content"><ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#%E5%87%86%E5%A4%87"><span class="toc-number">1.</span> <span class="toc-text">准备</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#Github"><span class="toc-number">2.</span> <span class="toc-text">Github</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#CloudFlare"><span class="toc-number">3.</span> <span class="toc-text">CloudFlare</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E7%BB%91%E5%AE%9A%E5%9F%9F%E5%90%8D"><span class="toc-number">4.</span> <span class="toc-text">绑定域名</span></a></li></ol></div></div><div class="card-widget card-recent-post"><div class="item-headline"><i class="fas fa-history"></i><span>最新文章</span></div><div class="aside-list"><!-- - let post_cover = article.cover--><div class="aside-list-item"><a class="thumbnail" href="/math/set_theory/unique_ordinal/" title="序数的唯一性"><img src="https://cdn.jsdelivr.net/gh/cnyist/blog/math/set_theory/unique_ordinal/unique_ordinal.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="序数的唯一性"/></a><div class="content"><a class="title" href="/math/set_theory/unique_ordinal/" title="序数的唯一性">序数的唯一性</a><time datetime="2022-01-12T08:26:12.000Z" title="发表于 2022-01-12 16:26:12">2022-01-12</time></div></div><!-- - let post_cover = article.cover--><div class="aside-list-item"><a class="thumbnail" href="/math/mathematical_analysis/mathematical_analysis_practice/3/3-1/" title="(史济怀) 数学分析教程上册第 3 版-练习题 3.1"><img src="https://cdn.jsdelivr.net/gh/cnyist/blog/math/mathematical_analysis/mathematical_analysis_practice/3/3-1/math.jpeg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="(史济怀) 数学分析教程上册第 3 版-练习题 3.1"/></a><div class="content"><a class="title" href="/math/mathematical_analysis/mathematical_analysis_practice/3/3-1/" title="(史济怀) 数学分析教程上册第 3 版-练习题 3.1">(史济怀) 数学分析教程上册第 3 版-练习题 3.1</a><time datetime="2021-10-19T00:30:55.000Z" title="发表于 2021-10-19 08:30:55">2021-10-19</time></div></div><!-- - let post_cover = article.cover--><div class="aside-list-item"><a class="thumbnail" href="/math/mathematical_analysis/mathematical_analysis_practice/2/2-11/" title="(史济怀) 数学分析教程上册第 3 版-练习题 2.11"><img src="https://cdn.jsdelivr.net/gh/cnyist/blog/math/mathematical_analysis/mathematical_analysis_practice/2/2-11/2-11.jpeg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="(史济怀) 数学分析教程上册第 3 版-练习题 2.11"/></a><div class="content"><a class="title" href="/math/mathematical_analysis/mathematical_analysis_practice/2/2-11/" title="(史济怀) 数学分析教程上册第 3 版-练习题 2.11">(史济怀) 数学分析教程上册第 3 版-练习题 2.11</a><time datetime="2021-09-25T03:37:28.000Z" title="发表于 2021-09-25 11:37:28">2021-09-25</time></div></div><!-- - let post_cover = article.cover--><div class="aside-list-item"><a class="thumbnail" href="/math/mathematical_analysis/mathematical_analysis_practice/2/2-10/" title="(史济怀) 数学分析教程上册第 3 版-练习题 2.10"><img src="https://cdn.jsdelivr.net/gh/cnyist/blog/math/mathematical_analysis/mathematical_analysis_practice/2/2-10/2-10.jpeg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="(史济怀) 数学分析教程上册第 3 版-练习题 2.10"/></a><div class="content"><a class="title" href="/math/mathematical_analysis/mathematical_analysis_practice/2/2-10/" title="(史济怀) 数学分析教程上册第 3 版-练习题 2.10">(史济怀) 数学分析教程上册第 3 版-练习题 2.10</a><time datetime="2021-09-22T07:36:49.000Z" title="发表于 2021-09-22 15:36:49">2021-09-22</time></div></div><!-- - let post_cover = article.cover--><div class="aside-list-item"><a class="thumbnail" href="/math/mathematical_analysis/mathematical_analysis_practice/2/2-9/" title="(史济怀) 数学分析教程上册第 3 版-练习题 2.9"><img src="https://cdn.jsdelivr.net/gh/cnyist/blog/math/mathematical_analysis/mathematical_analysis_practice/2/2-9/2-9.jpeg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="(史济怀) 数学分析教程上册第 3 版-练习题 2.9"/></a><div class="content"><a class="title" href="/math/mathematical_analysis/mathematical_analysis_practice/2/2-9/" title="(史济怀) 数学分析教程上册第 3 版-练习题 2.9">(史济怀) 数学分析教程上册第 3 版-练习题 2.9</a><time datetime="2021-09-20T08:19:06.000Z" title="发表于 2021-09-20 16:19:06">2021-09-20</time></div></div></div></div></div></div></main><footer id="footer"><div id="footer-wrap"><div class="copyright">&copy;2020 - 2022 By 云玩家</div><div class="framework-info"><span>框架 </span><a target="_blank" rel="noopener" href="https://hexo.io">Hexo</a><span class="footer-separator">|</span><span>主题 </span><a target="_blank" rel="noopener" href="https://github.com/jerryc127/hexo-theme-butterfly">Butterfly</a></div></div></footer><script>document.getElementById('web_bg').style = 'background-image: url("' + get_rand_jsd_pic('cnyist', 'banner@master', '/', 70, '-min.jpg') + '")'</script></div><div id="rightside"><div id="rightside-config-hide"><button id="readmode" type="button" title="阅读模式"><i class="fas fa-book-open"></i></button><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i></button><button class="close" id="mobile-toc-button" type="button" title="目录"><i class="fas fa-list-ul"></i></button><a id="to_comment" href="#post-comment" title="直达评论"><i class="fas fa-comments"></i></a><button id="go-up" type="button" title="回到顶部"><i class="fas fa-arrow-up"></i></button></div></div><div id="local-search"><div class="search-dialog"><div class="search-dialog__title" id="local-search-title">本地搜索</div><div id="local-input-panel"><div id="local-search-input"><div class="local-search-box"><input class="local-search-box--input" placeholder="搜索文章" type="text"/></div></div></div><hr/><div id="local-search-results"></div><span class="search-close-button"><i class="fas fa-times"></i></span></div><div id="search-mask"></div></div><div><script src="/js/utils.js"></script><script src="/js/main.js"></script><script src="/js/search/local-search.js"></script><div class="js-pjax"><script>(()=>{
  const $countDom = document.getElementById('twikoo-count')
  const init = () => {
    let initData = {
      el: '#twikoo-wrap',
      envId: 'yunist-147dfe',
      region: ''
    }

    if (false) {
      const otherData = false
      initData = Object.assign(initData, otherData)
    }
    
    twikoo.init(initData)
  }

  const getCount = () => {
    twikoo.getCommentsCount({
      envId: 'yunist-147dfe',
      region: '',
      urls: [window.location.pathname],
      includeReply: false
    }).then(function (res) {
      $countDom.innerText = res[0].count
    }).catch(function (err) {
      console.error(err);
    });
  }

  const loadTwikoo = (bool = false) => {
    if (typeof twikoo === 'object') {
      init()
      bool && $countDom && setTimeout(getCount,0)
    } else {
      getScript('https://cdn.jsdelivr.net/npm/twikoo/dist/twikoo.all.min.js').then(()=> {
        init()
        bool && $countDom && setTimeout(getCount,0)
      })
    }
  }

  if ('Twikoo' === 'Twikoo' || !false) {
    if (false) btf.loadComment(document.getElementById('twikoo-wrap'), loadTwikoo)
    else loadTwikoo(true)
  } else {
    window.loadOtherComment = () => {
      loadTwikoo()
    }
  }
})()</script></div><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script></div></body></html>